package com.foogui.guava;


import java.util.Optional;

public class OptionalDemo {
    public static void main(String[] args) {
        Optional<Object> empty = Optional.empty();
        Optional<String> book = Optional.of("book");
        empty.ifPresent(System.out::println);
        book.ifPresent(System.out::println);

        empty.orElse("默认值");
        empty.ifPresent(System.out::println);

        

    }
}
